-
-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
new lint: pub_api_sealed_trait_became_unconditionally_sealed
#1166
new lint: pub_api_sealed_trait_became_unconditionally_sealed
#1166
Conversation
pub_api_sealed_trait_became_unconditionally_sealed
error_message: "A public API sealed trait is now unconditionally sealed, preventing all external implementations. | ||
This change impacts related first-party crates (e.g., derive macros or other internal tooling) | ||
that previously could implement the trait using non-public API", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe this will get formatted correctly with our RON format. I think it'll end up stored and read as a multi-line string with the exact set of newline and consecutive space characters as exist in this file.
You can verify this by running cargo run -- semver-checks --manifest-path test_crates/pub_api_sealed_trait_became_unconditionally_sealed/new/Cargo.toml --baseline-root test_crates/pub_api_sealed_trait_became_unconditionally_sealed/old/Cargo.toml
and seeing whether the error message is printed correctly. I suspect it'll come out hard-wrapped in an unpredictable and undesirable way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, the output is rather abnormal. I rewritten that to match other queries
importable_path { | ||
path @filter(op: "=", value: ["%path"]) | ||
public_api @filter(op: "=", value: ["$true"]) | ||
} | ||
span_: span @optional { | ||
filename @output | ||
begin_line @output | ||
end_line @output | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Please take a look at some of the other lints' queries and try to match the style and formatting of queries. The fact that this query is so dense and has no whitespace means it's quite difficult to read.
This change prevents all external implementations, including from related first-party crates | ||
that might have relied on private API access", | ||
required_update: Major, | ||
lint_level: Deny, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the right lint level here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent work!
src/lints/pub_api_sealed_trait_became_unconditionally_sealed.ron
Outdated
Show resolved
Hide resolved
src/lints/pub_api_sealed_trait_became_unconditionally_sealed.ron
Outdated
Show resolved
Hide resolved
Head branch was pushed to by a user without write access
Resolves #1122